import {memberList} from '../../../request/api'

const state = {
    memberlist:[]
}

const getters = {
    getMember(state){
        return state.memberlist
    }
}

const mutations = {
    GETMEMBER(state,payload){
        // console.log(payload);
        state.memberlist = payload
        // console.log(state.memberlist);
    }
}

const actions = {
    // 封装一个获取列表行动
    getMemberListActions({commit}){
        // 调用接口
        // let res = await memberList()
        memberList().then(res => {
            if(res.code == 200){
                commit('GETMEMBER',res.list)
            }
        })
    }
}

export default {
    state,
    getters,
    mutations,
    actions,
    namespaced:true
}